<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0,viewport-fit=cover">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta http-equiv="Expires" content="0">
	<meta http-equiv="Pragma" content="no-cache">
	<meta http-equiv="Cache-control" content="no-cache">
	<meta http-equiv="Cache" content="no-cache">
	<title>֧支付转跳中-请等待</title>
	<style>
		html,
		body {
			height: 100%;
			overflow: hidden;
		}

		body {
			perspective-origin: 50% 50%;
			perspective: 1000px;
			background-color: #141d22;
			background: radial-gradient(ellipse at center, #082037 0%, #0a141a 50%);
		}

		.atome {
			position: absolute;
			top: 0;
			left: 0;
			width: 300px;
			height: 300px;
			right: 0;
			bottom: 0;
			margin: auto;
			transform-style: preserve-3d;
			animation: AtomeRotate 8s linear infinite;
		}

		.atome .circle {
			-webkit-border-radius: 100%;
			-moz-border-radius: 100%;
			-ms-border-radius: 100%;
			border-radius: 100%;
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
			transform-style: preserve-3d;
			animation: circleColor 20s linear infinite;
		}

		.atome .circle:after {
			-webkit-border-radius: 100%;
			-moz-border-radius: 100%;
			-ms-border-radius: 100%;
			border-radius: 100%;
			position: absolute;
			top: 0;
			left: 0;
			width: 15px;
			height: 15px;
			box-shadow: 0px 0px 30px rgba(191, 255, 0, 0.7),
				0px 0px 20px rgba(191, 255, 0, 0.5),
				0px 0px 10px rgba(191, 255, 0, 0.3),
				0px 0px 5px rgba(191, 255, 0, 0.1),
				0px 0px 15px rgba(191, 255, 0, 0.5) inset,
				0px 0px 10px rgba(191, 255, 0, 0.3) inset,
				0px 0px 5px rgba(191, 255, 0, 0.1) inset;
			bottom: 0;
			right: 0;
			margin: auto;
			background-color: white;
			content: "";
			animation: circleRotate 8s linear infinite;
		}

		.atome .circle .dot {
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
			display: block;
			animation: dotRotate 4s linear infinite;
			transform-style: preserve-3d;
		}

		.atome .circle .dot:before,
		.atome .circle .dot:after {
			-webkit-border-radius: 100%;
			-moz-border-radius: 100%;
			-ms-border-radius: 100%;
			border-radius: 100%;
			box-shadow: 0px 0px 30px rgba(0, 222, 255, 0.7),
				0px 0px 20px rgba(0, 222, 255, 0.5),
				0px 0px 10px rgba(0, 222, 255, 0.3),
				0px 0px 5px rgba(0, 222, 255, 0.1),
				0px 0px 15px rgba(0, 222, 255, 0.5) inset,
				0px 0px 10px rgba(0, 222, 255, 0.3) inset,
				0px 0px 5px rgba(0, 222, 255, 0.1) inset;
			content: "";
			position: absolute;
			width: 15px;
			height: 15px;
			background-color: #d3fcf2;
			background-color: white;
			top: 50%;
			left: -7px;
			transform-style: preserve-3d;
			transform: rotateX(90deg);
		}

		.atome .circle .dot:before {
			transform: rotateY(90deg);
		}

		.atome .circle:nth-child(1) {
			transform: rotateY(0deg);
		}

		.atome .circle:nth-child(1) .dot {
			animation-delay: 0s;
		}

		.atome .circle:nth-child(2) {
			transform: rotateY(18deg);
		}

		.atome .circle:nth-child(2) .dot {
			animation-delay: 0.2s;
		}

		.atome .circle:nth-child(3) {
			transform: rotateY(36deg);
		}

		.atome .circle:nth-child(3) .dot {
			animation-delay: 0.4s;
		}

		.atome .circle:nth-child(4) {
			transform: rotateY(54deg);
		}

		.atome .circle:nth-child(4) .dot {
			animation-delay: 0.6s;
		}

		.atome .circle:nth-child(5) {
			transform: rotateY(72deg);
		}

		.atome .circle:nth-child(5) .dot {
			animation-delay: 0.8s;
		}

		.atome .circle:nth-child(6) {
			transform: rotateY(90deg);
		}

		.atome .circle:nth-child(6) .dot {
			animation-delay: 1s;
		}

		.atome .circle:nth-child(7) {
			transform: rotateY(108deg);
		}

		.atome .circle:nth-child(7) .dot {
			animation-delay: 1.2s;
		}

		.atome .circle:nth-child(8) {
			transform: rotateY(126deg);
		}

		.atome .circle:nth-child(8) .dot {
			animation-delay: 1.4s;
		}

		.atome .circle:nth-child(9) {
			transform: rotateY(144deg);
		}

		.atome .circle:nth-child(9) .dot {
			animation-delay: 1.6s;
		}

		.atome .circle:nth-child(10) {
			transform: rotateY(162deg);
		}

		.atome .circle:nth-child(10) .dot {
			animation-delay: 1.8s;
		}

		@keyframes AtomeRotate {
			0% {
				transform: rotateX(0deg) rotateY(15deg);
			}

			100% {
				transform: rotateX(360deg) rotateY(15deg);
			}
		}

		@keyframes circleRotate {
			0% {
				transform: rotateX(0deg);
			}

			100% {
				transform: rotateX(360deg);
			}
		}

		@keyframes circleColor {
			0% {
				border: solid 1px rgba(191, 255, 0, 0);
			}

			80% {
				border: solid 1px rgba(191, 255, 0, 0);
			}

			90% {
				border: solid 1px rgba(191, 255, 0, 0.3);
			}

			100% {
				border: solid 1px rgba(191, 255, 0, 0);
			}
		}

		@keyframes dotRotate {
			0% {
				transform: rotate(0deg);
			}

			100% {
				transform: rotate(360deg);
			}
		}
	</style>
	<script th:src="@{/js/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/js/jquery.min.js}"></script>
</head>

<body>
	<div id="msg" style="color: aliceblue; text-align: center; margin-top: 10%; font-size: 15px;">
		<span>订单匹配中，请耐心等待</span>
		<br />
		<div style="font-size: 24px; margin-top: 20px;">
			倒计时:<span id="time"></span>秒
		</div>
	</div>
	<div id="atome" class="atome">
		<div class="circle">
			<span class="dot"></span><span class="dot"></span>
		</div>
		<div class="circle">
			<span class="dot"></span><span class="dot"></span>
		</div>
		<div class="circle">
			<span class="dot"></span><span class="dot"></span>
		</div>
		<div class="circle">
			<span class="dot"></span><span class="dot"></span>
		</div>
		<div class="circle">
			<span class="dot"></span><span class="dot"></span>
		</div>
		<div class="circle">
			<span class="dot"></span><span class="dot"></span>
		</div>
		<div class="circle">
			<span class="dot"></span><span class="dot"></span>
		</div>
		<div class="circle">
			<span class="dot"></span><span class="dot"></span>
		</div>
		<div class="circle">
			<span class="dot"></span><span class="dot"></span>
		</div>
		<div class="circle">
			<span class="dot"></span><span class="dot"></span>
		</div>
		<div class="circle">
			<span class="dot"></span><span class="dot"></span>
		</div>
	</div>

	<script>
		var id = '[[${id}]]';
		var time = '[[${leftTime}]]';
        var globalStatus = 0;//查询，1已有结果
        var loadtimer = setInterval(function() {
            time -= 1;

            if (time > 0) {
                document.getElementById('time').innerText = time;
            }
            else {
                clearInterval(loadtimer);
                if(globalStatus==0){
                	document.getElementById('msg').innerHTML = '<span>匹配失败，请重新下单</span>';	
                }  
            }
        }, 1000);
        
        var timerInterval;
        var isReturn = true;
        $(document).ready(function(){
            //循环执行，每隔1秒钟执行一次 1000 
            var t1=setInterval(refreshCount, 2500);
            function refreshCount() {
            	if(isReturn){
            		isReturn = false;
            		$.ajax({
                        //请求方式
                        type : "GET",
                        //请求地址
                        url : "[[@{/api/orderInfo.html?id=}]]"+id,
                        //请求成功
                        success : function(result) {
                            //alert(JSON.stringify(result));
                            if(result.data.status=="0"||result.data.status == "1"){
                            	clearInterval(t1);
                            	document.getElementById('msg').innerHTML ='<span>匹配成功，正在跳转...</span>';
                            	globalStatus = 1;
                            	//跳转
                            	window.location.href = "[[@{/api/payPage.html?id=}]]"+id;
                            }else if(result.data.status=="4"){//获取超时，请求重新下单！
                            	clearInterval(t1);
                            	clearInterval(timerInterval);
                            	//alert(JSON.stringify(result.msg));
                            	document.getElementById('msg').innerHTML ='<span>匹配失败，请重新下单</span>';
                            	globalStatus = 1;
                            	isReturn = false;
                            }
                            isReturn = true;
                        },
                        //请求失败，包含具体的错误信息
                        error : function(e){
                            isReturn = true;
                        }
                    });
            	}
            	
            }
         }); 
	</script>
</body>

</html>